<template>
	<base-page class="base-form" title="我的签到" @back="onCancel()" >
		<view style="overflow-y: auto;">
			<view v-for="(item,index) in CourseInfoSignList" :key="index" >
				<view v-if="item.isSign == 1">
					<u-card :title="item.title" padding="30" margin="26rpx">
						<view slot="body" style="display: flex;align-items: center;justify-content: space-between;">
							<view class="u-body-item-title u-line-2">签到地址：{{ item.signInAddress }}</view>
						</view>
						<view slot="foot">
							<view class="u-body-item-title u-line-2">签到时间：{{ item.createTime }}</view>
						</view>
					</u-card>
				</view>
				<view v-else>
					<u-card :title="item.title" padding="30" margin="26rpx">
						<view slot="body" style="display: flex;align-items: center;justify-content: space-between;">
							<view class="u-body-item-title u-line-2">未签到</view>
						</view>
						<view slot="foot">
							<view class="u-body-item-title u-line-2">上课时间：{{ item.attendClassTime }}</view>
						</view>
					</u-card>
				</view>
			</view>
		</view>

	</base-page>
</template>
<script>
	import {
		CourseInfoController
	} from "@/api";
	export default {
		data() {
			return {
				mySignInList: [],
				CourseInfoSignList: [],
				student: null
			}
		},
		onLoad(data) {
			if (data.data) {
				this.student = JSON.parse(decodeURIComponent(data.data))
			}

		},
		methods: {
			onCancel() {
				if (this.subPage) {
					this.$emit('close');
				} else {
					uni.navigateBack();
				}
			},
			getMySign() {
				// getSignByStudentId().then((res) => {
				// 	if (res.code == 200) {
				// 		this.mySignInList = res.data
				// 	}
				// })
			},
			getCourseInfoSignByStudentIdFun() {
				let studentId = null;
				if (this.student) {
					studentId = this.student.id
				} else {
					studentId = uni.getStorageSync('userId');
				}

				CourseInfoController.getCourseInfoSignByStudentId(this).then((res) => {
					
					// for (var i = 0; i < res.length; i++) {
					// 	if (res[i]) {
					// 		res[i].title = res[i].title + '(' + res[i].professorInfo.name + ')'
					// 	}

					// }
					this.CourseInfoSignList = res
				})
			}
		},
		mounted() {
			// this.getMySign();
			this.getCourseInfoSignByStudentIdFun();
		}
	}
</script>

<style>
</style>